package cn.ym.mall.dao;

import cn.ym.mall.entity.ActiveType;
import cn.ym.mall.entity.Activity;

import java.sql.SQLException;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author 漆家乐
 * 活动接口类
 */
public interface ActivityDao {
    /**
     * 发布活动
     * @param activity
     * @return
     * @throws SQLException
     */
    long add(Activity activity) throws SQLException;

    /**
     * 查询所有活动
     * @return
     * @throws SQLException
     */
    List<Activity> getAll() throws SQLException;

    /**
     * 分页查询所有活动
     * @param pageNo
     * @param pageSize
     * @return
     * @throws SQLException
     */
    List<Activity> getActivityPage(Integer pageNo,Integer pageSize) throws SQLException;

    /**
     * 查询未结束的活动
     * @param nowTime
     * @return
     * @throws SQLException
     */
    List<Activity> getActiveTypeNotFinished(LocalDateTime nowTime)throws SQLException;

    /**
     * 查询结束的活动
     * @param nowTime
     * @return
     * @throws SQLException
     */
    List<Activity> getActiveTypeFinished(LocalDateTime nowTime)throws SQLException;

    /**
     * 分页查询未结束的活动
     * @param nowTime
     * @param pageNo
     * @param pageSize
     * @return
     * @throws SQLException
     */
    List<Activity> getActiveTypeNotFinishedPage(LocalDateTime nowTime,Integer pageNo,Integer pageSize)throws SQLException;

    /**
     * 分页查询结束的活动
     * @param nowTime
     * @param pageNo
     * @param pageSize
     * @return
     * @throws SQLException
     */
    List<Activity> getActiveTypeFinishedPage(LocalDateTime nowTime,Integer pageNo,Integer pageSize)throws SQLException;

    /**
     * 查询活动总数
     * @return
     * @throws SQLException
     */
    long getActivityCount() throws SQLException;

    /**
     * 查询未结束的活动的总数
     * @param nowTime
     * @return
     * @throws SQLException
     */
    long getActivityNotFinishedCount(LocalDateTime nowTime) throws SQLException;

    /**
     *查询结束的活动的总数
     * @param nowTime
     * @return
     * @throws SQLException
     */
    long getActivityFinishedCount(LocalDateTime nowTime) throws SQLException;

}
